<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="${initParam.root }smarteditor/js/HuskyEZCreator.js" charset="utf-8"></script>

<script type="text/javascript">
	$(function(){
		 var oEditors = [];
		 nhn.husky.EZCreator.createInIFrame({
		 htParams :{ 
                 fOnBeforeUnload : function(){ 
                    //alert(&quot;onbeforeunload call&quot;);	
               }}, 
		 oAppRef: oEditors,
		 elPlaceHolder: "content", //textarea에서 지정한 id와 일치해야 합니다.
		 sSkinURI: "${initParam.root}smarteditor/SmartEditor2Skin.html",
		 fCreator: "createSEditor2"
		 
		 });
		 $("#writeF").submit(function(){
				if($("#content").val()==""){
					alert("내용을 입력하세요");
					return false;
				}
				if($("#title").val()==""){
					alert("제목을 입력하세요");
					return false;
				}
			});
		 
		var str=$("#content").val();
		var count=0;
		for(var i=0;i<str.length;i++){
			count++;
		}
		$("#letterCount").html(count); 
		
		$("#cancel").click(function(){
			if(confirm("수정을 취소하시겠습니까?")){
				location.href="${initParam.root}collection/auth_replyWriteDetailNohit.do?no=${requestScope.bvo.no}";
			}
		});
		
		$("#submitForm").click(function(){
			//alert($("#content").text());
			oEditors.getById["content"].exec("UPDATE_CONTENTS_FIELD", []);
			$("#updateF").submit();
		});	
		
		$("#fileView").hide();
		
		$("#fileDelete").click(function(){
			if(confirm("삭제하시겠습니까?")){
				//$(".fileName"+index+"").hide();
				var index=$("#fileList div").attr("class"); //인덱스 가져오기
				$(this).hide();
				return $(".fileView"+index+"").html("<input type=file name=files["+index+"] >");
			}
		});
		
	});
		
	function filePlus(){
		$("#filePlus").hide();
		$("#fileView").show();
	}
	
	
</script>
</head>
<body>
<form action="${initParam.root }collection/auth_replyUpdateGo.do" method="post"  id="updateF" >
	<input type="hidden" name="no" value="${requestScope.bvo.no}">
	<table>
	<tr><td>Title</td><td><input type="text" size="65" name="title" value="${requestScope.bvo.title }" id="title" readonly="readonly"></td></tr>
	</table>
	<table>
	
	<tr><td>Content</td></tr>
	</table>
	
	<textarea rows="22" style="width:500px;" name="content" id="content" >${requestScope.bvo.content } </textarea>
<br>
<p align="right" style="padding-right: 30px;">
<input type="button" id="cancel" value="취소">
<input type="button"  value="수정" id="submitForm"><br>
</p>
</form>


</body>
</html>